/*
 * @lc app=leetcode.cn id=26 lang=swift
 *
 * [26] 删除排序数组中的重复项
 */

// @lc code=start
class Solution26 {
    func removeDuplicates(_ nums: inout [Int]) -> Int {
        guard nums.count > 1 else {
            return nums.count
        }
        var left = 0
        for item in nums {
            if item != nums[left] {
                left += 1
                nums[left] = item
            }
        }
        return left + 1
    }
    static func test() {
        var array = [0,0,1,1,1,2,2,3,3,4]
        let solution =  Solution26()
        solution.removeDuplicates(&array)
        for item in array {
            print(item)
        }
    }
}
// @lc code=end

